/// 任何输出型生命周期都源自输入型生命周期
/// 用户手动指定生命周期: 函数签名、结构体和结构体字段、impl代码块

fn foo<'a>(a: &'a str, b: &'a str) -> &'a str {
    b
}

struct Number<'a> {
    num: &'a u8,
}

impl<'a> Number<'a> {
    fn get_num(&self) -> &'a u8 {
        self.num
    }

    fn set_num(&mut self, new_number: &'a u8) {
        self.num = new_number
    }
}

fn main() {
    let a = "Hello";
    let b = "World";
    let _c = foo(a, b);

    let mut num = Number { num: &12 };
    num.set_num(&13);
    println!("{:?}", num.get_num());
}



